from django.contrib.auth.models import User
from rest_framework import serializers
from bugs.models import Bugs, Dictionary

# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('url', 'username', 'email', 'is_staff')

class BugsSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Bugs
        fields = ('id', 'module', 'func', 'remark', 'createTime',
                  'createUser', 'solveUser', 'solveTime', 'solution', 'type')


class DictionarySerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Dictionary
        fields = ('id', 'code', 'name', 'pcode', 'spell', 'order', 'remark')